package cn.donting.jme.edit.ui.inspector.imp.mesh;

import cn.donting.jme.edit.attribute.Attribute;
import cn.donting.jme.edit.attribute.StringAttribute;
import cn.donting.jme.edit.ex.AttributeLoader;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;

import java.util.ArrayList;
import java.util.List;

/**
 * 兜底
 * Mesh 基本属性
 * @see com.jme3.scene.Mesh
 */
public class MeshAttributeLoader implements AttributeLoader<Mesh> {

    @Override
    public List<Attribute> getAttribute(Mesh mesh) {
        StringAttribute stringAttribute = new StringAttribute();
        stringAttribute.setEnabled(false);
        stringAttribute.setTitle("Mesh");
        stringAttribute.setValue(mesh.getClass().getName());

        ArrayList<Attribute> attributes = new ArrayList<>();
        attributes.add(stringAttribute);
        return attributes;
    }

    @Override
    public boolean isLoad(Object object) {
        if (object instanceof Geometry) {
            return true;
        }
        return false;
    }
}
